import * as sqlite3 from 'sqlite3';
import * as path from 'path';
import * as vscode from 'vscode';

export class Database {
  static single: any;

  public database: sqlite3.Database | undefined;

  private constructor() {

  }

  public createDatabase(context: vscode.ExtensionContext) {
    const dataBasePath = path.join(context.extensionPath, "./fast-mock.db");
    const sqlite = sqlite3.verbose();
    this.database = new sqlite.Database(dataBasePath, (err: any) => {
      console.log("new database error,", err.message);
    });
  }

  static getSingle(): Database {
    if (!this.single) {
      this.single = new Database();
    }
    return this.single;
  }
  
}